package com.example.proxy1_static;

public class ProxyMsg implements IMessage {
    IMessage msg;
    ProxyMsg(IMessage msg) {
        this.msg = msg;
    }

    public boolean conn() {
        System.out.println("connecting");
        return true;
    }

    public void close() {
        System.out.println("closing.");
    }

    @Override
    public void send(String str) {
        if (this.conn()) {
            msg.send(str);
            this.close();
        }
    }
}